Skip to content

feat(billing): wire pymthouse getPlans + subscribe checkout - #455

Draft
eliteprox wants to merge 5 commits into
mainfrom
feat/pymthouse-getplans-subscribe
Draft

feat(billing): wire pymthouse getPlans + subscribe checkout#455
eliteprox wants to merge 5 commits into
mainfrom
feat/pymthouse-getplans-subscribe

Conversation

@eliteprox

@eliteprox eliteprox commented Aug 6, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Implements BPP ④ getPlans on PymthouseAdapter via listBillingProductsmapBillingProductsToPlans (active products only).
  • Adds optional SPI subscribe? via SDK createBillingCheckout (@pymthouse/builder-sdk@0.6.3) → Builder POST /api/v1/apps/{clientId}/billing/checkout.
  • Billing BFF (provider_adapters): GET /api/v1/billing/{provider}/plans, POST /api/v1/billing/{provider}/subscribe.
  • Team multi-sub create with providerPlanId starts provider checkout before persisting the local row (no orphan on checkout failure) and returns checkoutUrl / subscriptionRef.
  • Aligns with pymthouse#386 checkout behavior: existing Starter is changed in-place; upstream 409 (active paid sub / PM required) is passed through as CONFLICT (not 503).
  • Docs: marketplace section + SDK pin updated in docs/pymthouse-integration.md.

Test plan

  • Targeted vitests (plans mapper, adapter, catalog parse, billing BFF, team subscriptions, 409 conflict mapping)
  • Pinned to published @pymthouse/builder-sdk@0.6.3
  • Manual: with provider_adapters ON + pymthouse M2M env, GET /api/v1/billing/pymthouse/plans returns live products
  • Manual: POST …/subscribe with a real planId returns a Stripe Checkout URL
  • Manual: subscribe when already on an active paid plan returns 409 CONFLICT (not 503)

Expose BPP plan catalogue and optional M2M checkout through the
PymthouseAdapter so agent/BFF callers can list plans and start Stripe
Checkout without inventing marketplace UI or last-mile credit APIs.
@vercel

vercel Bot commented Aug 6, 2026

Copy link
Copy Markdown
Contributor

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
naap-platform Ready Ready Preview Aug 7, 2026 6:09pm

Request Review

@github-actions github-actions Bot added the size/XL Extra large PR (500+ lines) label Aug 6, 2026
@github-actions

github-actions Bot commented Aug 6, 2026

Copy link
Copy Markdown

⚠️ This PR is very large (733 lines changed). Please split it into smaller, focused PRs if possible.

@github-actions github-actions Bot added the scope/shell Shell app changes label Aug 6, 2026
@eliteprox
eliteprox marked this pull request as draft August 6, 2026 02:12
Drop the hand-rolled M2M checkout helper; adapter.subscribe and error
mapping now go through PmtHouseClient / PmtHouseError from builder-sdk.
@eliteprox

Copy link
Copy Markdown
Contributor Author

Follow-up pushed: subscribe now uses @pymthouse/builder-sdk createBillingCheckout (git pin to feat/create-billing-checkout until 0.6.2 publishes). Hand-rolled pymthouse-billing-checkout.ts removed; route errors map PmtHouseError.

Related:

builder-sdk#50 merged and published; replace the git branch pin so
createBillingCheckout comes from the npm release.
@eliteprox

Copy link
Copy Markdown
Contributor Author

Pinned to published @pymthouse/builder-sdk@0.6.2 now that pymthouse/builder-sdk#50 is merged.

Move off the interim 0.6.2 pin to the published Sonar/CI security patch.
@eliteprox

Copy link
Copy Markdown
Contributor Author

Bumped pin to published @pymthouse/builder-sdk@0.6.3.

Builder checkout (pymthouse#386) returns 409 when a customer already has
an active subscription or needs a payment method before plan change.
Map that to CONFLICT instead of treating it as a transient 503.
@eliteprox

Copy link
Copy Markdown
Contributor Author

Follow-up for pymthouse#386: Builder POST …/billing/checkout now returns 409 for active-subscription / payment-method conflicts (instead of opaque Konnect failures). NaaP billing BFF + team multi-sub create map that to CONFLICT so callers can change plan / complete Checkout rather than retrying as if the provider were down.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

scope/shell Shell app changes size/XL Extra large PR (500+ lines)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant